axios
.get("/danwei/api/name")
.then((res) => res.data.results)
.then((danwei) =>danwei.map((i) => {
    return {
    label: i.name,
    value: i.id,
    };
}))
.then(data=>{
    state.建议参会单位Options=data;
})

axios
.get("/danwei/api/name")
.then((res) => res.data.results)
.then((danwei) =>danwei.map((i) => {
    return {
    label: i.name,
    value: i.id,
    };
}))
.then(data=>{
    state.建议参会单位Options=data;
})

watch(()=>state.formData.建议参会单位,(newData,oldData)=>{
    state.建议参会人员Options=[];
    axios
    .get("/chushi/api/danwei_id")
    .then((res) => res.data.results)
    .then(chushi=>chushi.filter(i=>newData.some(j=>i.danwei_id===j)))
    .then(chushi=>{
        axios
            .get("/person/viewsets/")
            .then((res) => res.data.results)
            .then(person=>person.filter(i=>chushi.some(j=>i.chushi_id===j.id)))
            .then((person) =>person.map((i) => {
                return {
                    label: i.name,
                    value: i.id,
                };
            }))
            .then(person=>{
                state.建议参会人员Options.push(...person);
            })
    })
})
